package edu.unmsm.ocaa.sisocaa.integracion.dao.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DataAccessException;
import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;
import org.springframework.stereotype.Repository;

import com.ibatis.sqlmap.client.SqlMapClient;

import edu.unmsm.ocaa.sisocaa.integracion.dao.DependenciaDAO;
import edu.unmsm.ocaa.sisocaa.negocio.model.dto.DependenciaDTO;

@Repository
public class DependenciaDAOImpl extends SqlMapClientDaoSupport implements DependenciaDAO {

	@Autowired
	public DependenciaDAOImpl(SqlMapClient sqlmap) {
		super.setSqlMapClient(sqlmap);
		// TODO Auto-generated constructor stub
	}


	public List<DependenciaDTO> getDep(Integer idDep)
			throws DataAccessException {
		// TODO Auto-generated method stub
		return (List<DependenciaDTO>)getSqlMapClientTemplate().queryForList("getDep", idDep);
	}


	public void insertDep(DependenciaDTO dep) throws DataAccessException {
		// TODO Auto-generated method stub
		getSqlMapClientTemplate().insert("insertDep", dep);
	}


	public void updateDep(DependenciaDTO dep) throws DataAccessException {
		// TODO Auto-generated method stub
		getSqlMapClientTemplate().update("updateDep", dep);
	}


	@Override
	public List<DependenciaDTO> getDeps() throws DataAccessException {
		// TODO Auto-generated method stub
		return (List<DependenciaDTO>)getSqlMapClientTemplate().queryForList("getDeps");
	}


	@Override
	public List<DependenciaDTO> getDepxDsc(String dscDep) {
		// TODO Auto-generated method stub
		return (List<DependenciaDTO>)getSqlMapClientTemplate().queryForList("getDepxDsc",dscDep);
	}

}
